{% load common_extras %}
{% load static %}
<div class="header">
    <div class="left">
        <a href="{% url 'index' %}" class="func">
            <img src="{% static 'images/index.png' %}" alt="首页" class="icon">
        </a>
        <a href="{% url 'learning_center' %}" class="func">学习中心</a>
        <a href="{% url 'community_home' %}" class="func">社区</a>
    </div>

    <div class="middle">
        <form method="post" class="search-form">
            {% csrf_token %}
            <input type="text" id="key_words" name="key_words" placeholder="请输入搜索内容" class="search-input">
            <input type="submit" class="submit-btn" value="搜索">
        </form>
    </div>

    <div class="right">
        <a href="{% url 'footprint' 'history' %}" class="func">
            <img src="{% static 'images/clock.png' %}" alt="浏览历史" class="icon">
        </a>
        <a href="{% url 'chat' %}" class="func">
            <img src="{% static 'images/remind.png' %}" alt="消息" class="icon">
        </a>
        <a href="{% url 'footprint' 'collection' %}" class="func">
            <img src="{% static 'images/collection.png' %}" alt="收藏" class="icon">
        </a>
        {% if username %}
            <span class="user-info">{{ username|capfirst }}</span>
            <a href="{% url 'user_center' %}"><img src="/static/media/img/{{ user.cover }}" alt="用户头像" class="user-avatar"></a>
            <a href="{% url 'logout' %}" class="logout">退出登录</a>
        {% else %}
            <a href="{% url 'login' %}" class="login">立即登录</a>
        {% endif %}
    </div>
</div>
